package com.hyny.framework.platform.system.utils.enums;

import com.alibaba.fastjson.annotation.JSONType;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.hyny.framework.base.enums.ITagEnumBean;
import com.hyny.framework.base.enums.TagEnumBean;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

/**
 * 字段权限类型
 */
@Getter
@AllArgsConstructor
@JSONType(serializeEnumAsJavaBean = true)
public enum FieldPowerTypeEnum implements ITagEnumBean {
    CLASS("C","请求类",""),
    METHOD("M","请求方法",""),
    FIELD("F","字段","");

    @EnumValue
    private  String code;
    private  String msg;
    private  String colour;


    @Override
    public TagEnumBean getEnumBean(){
        TagEnumBean tagEnumBean =new TagEnumBean();
        tagEnumBean.setEStyle(this.colour);
        tagEnumBean.setEValue(this.code);
        tagEnumBean.setEText(this.msg);
        tagEnumBean.setEName(this.name());
        return tagEnumBean;
    }

    /**
     * 获取全部枚举信息
     * @return
     */
    public static List<TagEnumBean> FieldPowerTypeEnum() {
        List<TagEnumBean> list=new ArrayList<>();
        for (FieldPowerTypeEnum bean: values()
        ) {
            list.add(bean.getEnumBean());
        }
        return list;
    }


}
